package com.cn.zengzeng.spbzengzeng.clone;

import java.io.Serializable;

/**
 * @Description: 浅拷贝：创建一个新对象，然后将当前对象的非静态字段复制到该新对象，如果字段是值类型的，那么对该字段执行复制；如果该字段是引用类型的话则复
 * 制引用但不复制引用的对象。因此，原始对象及其副本引用同一个对象
 * @Author: ZhangZengZeng
 * @Date: 2022/5/9 14:30
 */

public class Test implements Cloneable, Serializable {
    private static final long serialVersionUID = -8680700211646929590L;
    private String name ;
    private Integer age ;
    public Test01 test01 ;

    @Override
    protected Object clone () throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    protected void finalize () throws Throwable {
        super.finalize();
    }

    public static long getSerialVersionUID () {
        return serialVersionUID;
    }

    public Test () {
    }

    public Test01 getTest01 () {
        return test01;
    }

    public void setTest01 (Test01 test01) {
        this.test01 = test01;
    }

    public Test (String name,Integer age) {
        this.name = name;
        this.age = age;
    }
    public void display(String cname){
        System.out.println("cname:"+cname+" "+name +"   age:"+age +"  ADDRESS:"+test01);
    }
    public String getName () {
        return name;
    }

    public void setName (String name) {
        this.name = name;
    }

    public Integer getAge () {
        return age;
    }

    public void setAge (Integer age) {
        this.age = age;
    }
}
